#include <iostream>
#include <string>

class Student
{
public:
    Student()
    {
        //std::cout<<"父类无参构造！\n";
    }

    Student(int id,const std::string & name):id(id),name(name)
    {
        //std::cout<<"父类构造!\n";
    }
    ~Student()
    {
        //std::cout<<"父类析构!\n";
    }


    void show()
    {     
        std::cout<<id<<""<<name<<std::endl;
    }

    static void print() //静态函数也可以被继承
    {
        count++;
        std::cout<<"helloworld"<<std::endl;
    }
public:
    int id;
    std::string name;

    static int count;
};
int Student::count =0;
class PrimaryStudent : public Student
{
public:
    PrimaryStudent():Student(0,""),score(0)
    {
        //std::cout<<"子类无参构造！\n";
    }
    PrimaryStudent(int id,const std::string&name,int score):Student(id,name),score(score)
    {
       
        //std::cout<<"子类构造!\n";
    }
    ~PrimaryStudent()
    {
        //std::cout<<"子类析构!\n";
    }
    //名词遮蔽：父类函数和子类函数同名，子类无法调用父类同名函数
    void show(int a)
    {
        Student::show();//通过明确函数的域，来调用父类函数
        std::cout<<score<<std::endl;
    }

private:
    int score;//新定义的自己的属性

public:
    static int count; //父类的静态变量被遮蔽
};

int PrimaryStudent::count=0;

int main()
{
    Student s(1,"lisi");
    s.print();
    std::cout<<s.count<<std::endl;
    PrimaryStudent s1(1,"zhangsan",100);
    s1.print();
    //s.show();
    std::cout << s1.count <<std::endl;
    return 0;

}
